import request from "@/router/axios";

export const getPage = (page, params) => {
  return request({
    url: "/admin/teamcard/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};
//司机常用车辆列表
export const carByDrivers = (page, params) => {
  return request({
    url: "/admin/teamusercar/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};
//司机成员列表
export const getDrivers = (page, params) => {
  return request({
    url: "/admin/teamuser/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};

//司机成员新增
export const saveDriver = (form) => {
  return request({
    url: "/admin/teamuser/save",
    method: "post",
    data: {
      ...form,
    },
  });
};
//司机成员删除
export const removeDriver = (id) => {
  return request({
    url: "/admin/teamuser/remove",
    method: "post",
    params: {
      ids: id,
    },
  });
};
//司机成员月额度设置
export const monthlyLimitSettingByDriver = (form) => {
  return request({
    url: "/admin/teamuser/updateCreditMoney",
    method: "post",
    data: {
      ...form,
    },
  });
};
//加注卡新增
export const save = (form) => {
  return request({
    url: "/admin/teamcard/save",
    method: "post",
    data: {
      ...form,
    },
  });
};
//加注卡删除
export const removeTeamcard = (id) => {
  return request({
    url: "/admin/teamcard/remove",
    method: "post",
    params: {
      ids: id,
    },
  });
};

//加注卡月额度设置
export const monthlyLimitSetting = (form) => {
  return request({
    url: "/admin/teamcard/monthlyLimitSetting",
    method: "post",
    data: {
      ...form,
    },
  });
};
//启用禁用加注卡
export const updateStatus = (form) => {
  return request({
    url: "/admin/teamcard/updateStatus",
    method: "post",
    data: {
      ...form,
    },
  });
};

export const update = (form) => {
  return request({
    url: "/api/uic-system/fillteamuser/update",
    method: "post",
    data: {
      ...form,
    },
  });
};

export const remove = (id) => {
  return request({
    url: "/api/uic-system/fillteamuser/remove",
    method: "post",
    params: {
      ids: id,
    },
  });
};

export const bindCard = (form) => {
  return request({
    url: "/api/uic-system/fillteamuser/bindCard",
    method: "post",
    data: {
      ...form,
    },
  });
};

// 绑定电子卡
export const bindCard2 = (form) => {
  return request({
    url: "/api/uic-system/fillteamcar/bindCard",
    method: "post",
    data: {
      ...form,
    },
  });
};

// 绑定司机
export const bindCar = (form) => {
  return request({
    url: "/admin/teamusercar/bindCar",
    method: "post",
    data: {
      ...form,
    },
  });
};

// 解绑司机
export const unbindCar = (carId, userId) => {
  return request({
    url: "/api/uic-system/fillteamuser/unbindCar",
    method: "post",
    data: {
      id: userId,
      carId,
    },
  });
};
